<template>
  <div class="landTastDetail">
    <main-layout>
      <bar-title title="预警详情" back />
      <!-- <div class="itemBox">
        <ul class="itemList">
          <li>标题：<span>{{details.title}}</span></li>
          <li>状态：
            <span>
              <template v-if="details.isSend==0">未发送</template>
              <template v-else-if="details.isSend==1">已发送</template>
            </span>
          </li>
          <li>发送日期：<span>{{details.isSend==1?details.updateTime:'--'}}</span></li>
          <li>创建人：<span>{{details.createName}}</span></li>
          <li>创建日期：<span>{{details.createTime}}</span></li>
          <li>通知方位：
            <span v-if="details.notifyArea">
                <template v-for="(dt,index) in JSON.parse(details.notifyArea)" :key="index">
                  {{dt.province}}{{dt.city}}{{dt.area}}
                  <template v-if="index<JSON.parse(details.notifyArea).length-1">、</template>
                </template>
            </span>
          </li>
        </ul>
      </div>
      <div class="itemBox itemBox2">
        <ul class="itemList"><li>通知内容：</li></ul>
      </div> -->
      <div class="msgContentBox" style="margin-top: 20px;">
        <h1>{{ details.title }}</h1>
        <!-- <div class="timeFrom">
          <img src="/src/assets/shijian.png" alt="">
          <label>发布时间：</label>
          <span>2022.03.12  09:38:04</span>
          <div class="line" />
          <img src="/src/assets/laiyuan.png" alt="">
          <label>来源：</label>
          <span>重庆市</span>
        </div> -->
        <div class="content" v-html="details.content" />
      </div>
    </main-layout>
  </div>
</template>

<script setup>
// 这里的name是为了做页面缓存，其值要跟路由里面的name值一样

import { nextTick, ref, reactive, watch, onActivated, onMounted } from 'vue'
import { useRouter, useRoute } from 'vue-router'

import { addNotify, addNotifyDetail, editNotify } from '@/api/system'

import { useUserStore } from '@/pinia/modules/user'
import { emitter } from '@/utils/bus.js'
import mainLayout from '@/components/custom/mainLayout.vue'
import { message } from '@/utils/element'
import barTitle from '@/view/produceManage/task/components/barTitle.vue'

const router = useRouter()
const route = useRoute()
const userStore = useUserStore()

const notifyId = ref('')
const details = ref({})

onMounted(async() => {
  notifyId.value = router.currentRoute.value.query.id
  if (notifyId.value) {
    const res = await addNotifyDetail(notifyId.value)
    if (res.code == 0 || res.success) {
      details.value = res.data
    } else {
      message('获取数据出错了', 3)
    }
  }
})

const close = () => {
  emitter.emit('closeThisPage')
}

</script>
<style lang="scss" scoped>
.itemBox{
  background: #F7F7F7;
  border-radius: 0px 2px 2px 0px;
  border: 1px solid #EEEEEE;
  padding:10px 20px 20px 20px;
  margin: 12px 0 0 0;
  &.itemBox2{
    margin: 0;
    padding-top: 8px;
    padding-bottom: 8px;
    background: none;
    border: 1px solid #fff;
    .itemList{
      li{
        margin-top: 0;
      }
    }
  }
  .itemList{
      list-style: none;
      padding: 0;
      margin: 0;
      &::after{
        content: '';
        display: block;
        clear: both;
        height: 0;
      }
      li{
          display: flex;
          float: left;
          align-items: center;
          height: 30px;
          font-size: 14px;
          font-family: PingFangSC, PingFang SC;
          font-weight: 700;
          color: #333333;
          width: 25%;
          margin-top: 10px;
          @media screen and (max-width: 1410px) { //宽度小于1410px的时候被应用  移动端
            width: 33.3333%;
          }
          @media screen and (max-width: 1010px) { //宽度小于1410px的时候被应用  移动端
            width: 50%;
          }
          &::before{
              content: '';
              width: 5px;
              height: 5px;
              line-height: 0;
              overflow: hidden;
              border-radius: 50%;
              background-color: #999999;
              margin: 0 6px 0 0;
          }
          span{
              color: #999;
              font-weight:500
          }
      }
  }
  .taskContent{
      font-size: 14px;
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      color: #666666;
      line-height: 20px;
      padding: 0 0 0 12px;
  }
}

</style>
<style lang="scss">
.msgContentBox{
background: #F7F7F7;
border: 1px solid #EEEEEE;
padding: 20px;
h1{
  font-size: 22px;
  font-family: PingFangSC, PingFang SC;
  font-weight: 600;
  color: #333333;
  text-align: center;
  padding: 10px 0 0 0;
}
.timeFrom{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  width: 700px;
  background: url(/src/assets/msgbg.png) left top no-repeat;
  background-size: 100% 100%;
  margin: 0 auto;
  margin-top: 18px;
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  color: #333333;
  font-size: 14px;
  label{
    font-weight: 600;
  }
  span{
    color: #747776;
  }
  img{
    display: block;
    height: 18px;
    margin: 0 8px 0 0;
  }
  .line{
    width: 1px;
    height: 15px;
    background: #D4D4D4;
    margin: 0 20px;
  }
}
.content{
  font-size: 14px;
  font-family: PingFangSC, PingFang SC;
  font-weight: 400;
  color: #333333;
  line-height: 24px;
  white-space:pre-line;
  padding: 50px 0 0 0;
  p,span,div{
    font-size: 14px;
  }
  img{
    max-width: 100%!important;
  }
}

}
</style>
